package cn.zsssgjcx.hjsg.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import cn.zsssgjcx.hjsg.R;
import cn.zsssgjcx.hjsg.adapter.RouteAdapter;
import cn.zsssgjcx.hjsg.model.RouteInfo;
import cn.zsssgjcx.hjsg.utils.StatusBarUtils;

public class RouteActivity extends AppCompatActivity {

    private ListView lv_route;
    private List<RouteInfo> routeInfoList = new ArrayList<>();
    private RouteAdapter routeAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_route);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(ContextCompat.getColor(this, R.color.white));

            //状态栏设置为白亮，就是图标为白色
            StatusBarUtils.setLightStatusBar(this, true, false);
        }

        lv_route = findViewById(R.id.lv_route);

        routeInfoList.add(new RouteInfo());
        routeInfoList.add(new RouteInfo());

        routeAdapter = new RouteAdapter(RouteActivity.this,routeInfoList);

        lv_route.setAdapter(routeAdapter);

        lv_route.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent = new Intent(RouteActivity.this,RouteDetailActivity.class);
                startActivity(intent);
            }
        });
    }
}